
var FPopup = {    
    width:550,
    height:380,
    hasContainer:false,
    titltePopupText:"",
    titlePopupClassName: "title_fpopup",
    popupClassName:"fpopup",
    contentClassName:"content_fpopup",
    closeIconClassName:"close_icon_fpopup",
    position:"fixed",
    isProcessing:false,
    titleObj:document.createElement('div'),
    popupObj:document.createElement('div'),
    contentObj:document.createElement("div"),
    showDialogIFrame:function (url,params){
       if(!FPopup.isProcessing){
            if(!FPopup.hasContainer){
                //get body size
                 var bodyWidth = 0, bodyHeight = 0;
                 if (typeof(window.innerWidth) === 'number') {
                      //Non-IE
                      bodyWidth = window.innerWidth;
                      bodyHeight = window.innerHeight;
                 } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                      //IE 6+ in 'standards compliant mode'
                      bodyWidth = document.documentElement.clientWidth;
                      bodyHeight = document.documentElement.clientHeight;
                 } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
                      //IE 4 compatible
                      bodyWidth = document.body.clientWidth;
                      bodyHeight = document.body.clientHeight;
                 }

                 FPopup.popupObj.style.display="none";
                 FPopup.popupObj.style.width = FPopup.width+"px";
                 FPopup.popupObj.style.height = FPopup.height+"px";
                 FPopup.popupObj.className = FPopup.popupClassName;


                 var paddingLeftForTitle = 10;
                 FPopup.titleObj.style.width = FPopup.popupObj-paddingLeftForTitle+"px";
                 FPopup.titleObj.style.paddingLeft = paddingLeftForTitle+"px";
                 FPopup.titleObj.className = FPopup.titlePopupClassName;
                 FPopup.hasContainer = true;

                 //update itoa of div
                 FPopup.popupObj.style.position = FPopup.position;
                 FPopup.popupObj.style.left=((bodyWidth-FPopup.width)/2)+"px";

                 //create frame
                 FPopup.contentObj.width= FPopup.width+"px";
                 FPopup.contentObj.className = FPopup.contentClassName;

                 //create icon close
                 var iconClose = document.createElement("div"); 
                 iconClose.className = FPopup.closeIconClassName;
                 iconClose.onclick=function(){
                     FPopup.closeDialogIFrame();
                 };

                 FPopup.popupObj.appendChild(iconClose);
                 FPopup.popupObj.appendChild(FPopup.titleObj);
                 FPopup.popupObj.appendChild(FPopup.contentObj);
                 document.body.appendChild(FPopup.popupObj);
            }

            FPopup.loading();

            var topScroll = window.pageYOffset || document.documentElement.scrollTop;
            if(FPopup.position === "fixed"){
                 FPopup.popupObj.style.top=  ((bodyHeight-FPopup.height)/2) +"px";
            }else{
                 FPopup.popupObj.style.top= ( topScroll +  ((bodyHeight-FPopup.height)/2) )+"px";
            }

            FPopup.loadContentSite(url,params);
            FPopup.titleObj.innerHTML = FPopup.titltePopupText;
            
       }
    },
            
    closeDialogIFrame:function(){
        if(!FPopup.isProcessing){
            FPopup.popupObj.style.display="none";
        }
    },
            
    loadContentSite:function(url,params){
        function callBack(result){
            $(document).ready(function () {
                $(FPopup.contentObj).html(result);
                
            });
            FPopup.popupObj.className = FPopup.popupClassName ;
            FPopup.stopLoading();
            FPopup.popupObj.style.display = "";
        };
        FPopup.callAsyncFunction(url,params,callBack);
    },
    
    //Overide
    loading:function(){},
    stopLoading:function(){},
    callAsyncFunction:function(url,params,callBack){}
};